namespace SGSBillBoard.Context.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Fighter",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Nation = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Player",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Department = c.String(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Score",
                c => new
                    {
                        ID = c.Guid(nullable: false, identity: true),
                        IsWinner = c.Boolean(nullable: false),
                        IsShowFirst = c.Boolean(nullable: false),
                        Chief_ID = c.Int(),
                        Player_ID = c.Int(),
                        Session_ID = c.Guid(),
                        Vice_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.Fighter", t => t.Chief_ID)
                .ForeignKey("dbo.Player", t => t.Player_ID)
                .ForeignKey("dbo.Session", t => t.Session_ID)
                .ForeignKey("dbo.Fighter", t => t.Vice_ID)
                .Index(t => t.Chief_ID)
                .Index(t => t.Player_ID)
                .Index(t => t.Session_ID)
                .Index(t => t.Vice_ID);
            
            CreateTable(
                "dbo.Session",
                c => new
                    {
                        ID = c.Guid(nullable: false, identity: true),
                        PlayerNumber = c.Int(nullable: false),
                        GameDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Score", "Vice_ID", "dbo.Fighter");
            DropForeignKey("dbo.Score", "Session_ID", "dbo.Session");
            DropForeignKey("dbo.Score", "Player_ID", "dbo.Player");
            DropForeignKey("dbo.Score", "Chief_ID", "dbo.Fighter");
            DropIndex("dbo.Score", new[] { "Vice_ID" });
            DropIndex("dbo.Score", new[] { "Session_ID" });
            DropIndex("dbo.Score", new[] { "Player_ID" });
            DropIndex("dbo.Score", new[] { "Chief_ID" });
            DropTable("dbo.Session");
            DropTable("dbo.Score");
            DropTable("dbo.Player");
            DropTable("dbo.Fighter");
        }
    }
}
